home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 November / PCWorld_2006-11_cd.bin / domacnost a kancelar / easytime / ETT.exe / reports / xslt / DetailedInvoice.xsl next >
Extensible Markup Language  |  2006-08-18  |  9KB  |  223 lines

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" indent="yes"/>
  4.     <xsl:template match="/">
  5.         <html>
  6.           <head>
  7.            <link rel="stylesheet" type="text/css" href="style.css" />
  8.          </head>
  9.             <xsl:apply-templates select="/Report/HeaderInfo"></xsl:apply-templates>
  10.           <xsl:apply-templates select="/Report/Customer"></xsl:apply-templates>
  11.           <xsl:apply-templates select="/Report/Customer/Project" mode="customer-project"/>
  12.           <xsl:apply-templates select="/Report/Customer/Tax"></xsl:apply-templates>
  13.           <xsl:apply-templates select="/Report/Customer/Total"></xsl:apply-templates>
  14.         </html>
  15.     </xsl:template>
  16.  
  17.   <!-- ╨Æ╨╡╤Ç╤à╨╜╨╕╨╣ ╨╖╨░╨│╨╛╨╗╨╛╨▓╨╛╨║  -->
  18.     <xsl:template match="HeaderInfo">
  19.         <table class="TableSB" align="center" width="70%">
  20.             <tr>
  21.                 <td>
  22.                     <table class="TableSB" width="100%" cellpadding="2" cellspacing="0" >
  23.                         <tr>
  24.                             <td colspan="2" align="center" class="ReportTitleClass">Invoice# <xsl:value-of select="InvoiceNumber"/></td>
  25.                         </tr>
  26.                         <tr>
  27.                             <td colspan="2" align="right"  class="Date"><xsl:value-of select="CurrentDate"/></td>
  28.                         </tr>
  29.                     </table>
  30.                 </td>
  31.             </tr>
  32.         </table>
  33.     </xsl:template>
  34.  
  35.  <xsl:template match="Customer">
  36.    <table align="center" width="70%">
  37.      <tr>
  38.        <td class="DetailRowTitleClass">Bill to:</td>
  39.      </tr>
  40.      <tr>
  41.        <td class="CompanyName" colspan="2">
  42.          <xsl:value-of select="Name"/>
  43.        </td>
  44.      </tr>
  45.    </table>
  46.    <table align="center" width="70%">
  47.     <xsl:if test="Address">
  48.        <tr>
  49.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address"/> </td>
  50.        </tr>
  51.      </xsl:if>
  52.     <xsl:if test="Address2">
  53.        <tr>
  54.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address2"/> </td>
  55.        </tr>
  56.      </xsl:if>
  57.      <xsl:if test="City">
  58.        <tr>
  59.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="City"/></td>
  60.        </tr>
  61.      </xsl:if>
  62.      <xsl:if test="State">
  63.        <tr>
  64.          <td class="DetailRowDataClass" width="100%">
  65.            <xsl:value-of select="State"/>
  66.          </td>
  67.        </tr>
  68.      </xsl:if>
  69.      <xsl:if test="Country">
  70.        <tr>
  71.          <td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Country"/>
  72.          </td>
  73.        </tr>
  74.      </xsl:if>
  75.      <xsl:if test="Zip">
  76.        <tr>
  77.          <td class="DetailRowDataClass" width="100%">
  78.            <xsl:value-of select="Zip"/>
  79.          </td>
  80.        </tr>
  81.      </xsl:if>
  82.      <xsl:if test="Phone">
  83.        <tr>
  84.          <td class="DetailRowDataClass" width="100%">
  85.            <xsl:value-of select="Phone"/>
  86.          </td>
  87.        </tr>
  88.      </xsl:if>
  89.      <xsl:if test="Fax">
  90.        <tr>
  91.          <td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Fax"/>
  92.          </td>
  93.        </tr>
  94.      </xsl:if>
  95.    </table>
  96.      <xsl:if test="string(//Report/HeaderInfo/Terms)!=''">    
  97.      <table align="center" width="70%">
  98.        <tr>
  99.          <td class="DetailRowTitleClass">Terms:</td>
  100.         <td class="DetailRowDataClass" width="100%"><xsl:value-of select="//Report/HeaderInfo/Terms"/></td>
  101.             </tr>
  102.      </table>
  103.    </xsl:if>
  104.   </xsl:template>
  105.  
  106.     <xsl:template match="/Report/Customer/Project" mode="customer-project">
  107.         <xsl:if test="Date">
  108.             <table align="center" width="70%">
  109.             <tr>
  110.                 <td colspan="6" class="ProjectName">Project: <span class="Pname">
  111.           <xsl:value-of select="@Name"/></span><br/>Date Range: <xsl:value-of select="//HeaderInfo/Date/From"/> - <xsl:value-of select="//HeaderInfo/Date/To"/></td>
  112.             </tr>
  113.             <!--<xsl:if test="position()=1"> -->
  114.                 <tr>
  115.                 
  116.                     <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
  117.                         <td width="10%" class="DetailRowTitleClass">Date</td>
  118.                         <td width="30%" class="DetailRowTitleClass">Task</td>
  119.                         <td width="30%" class="DetailRowTitleClass">Description</td>
  120.                         <td width="5%" class="DetailRowTitleClassCenter">Rate</td>
  121.                         <td width="10%" class="DetailRowTitleClassCenter">Hours</td>
  122.                         <td width="10%" class="DetailRowTitleClassCenter">Amount</td>
  123.                     </xsl:if>    
  124.                     <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
  125.                         <td width="10%" class="DetailRowTitleClass">Date</td>
  126.                         <td  class="DetailRowTitleClass">Task</td>
  127.                         <td width="10%" class="DetailRowTitleClassCenter">Rate</td>
  128.                         <td width="20%" class="DetailRowTitleClassCenter">Hours</td>
  129.                         <td width="20%" class="DetailRowTitleClassCenter">Amount</td>
  130.                     </xsl:if>
  131.                 </tr>
  132.           <!-- </xsl:if>  -->
  133.              <xsl:apply-templates select="Date" mode="customer-date"/>
  134.             <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">    
  135.               <tr>
  136.                 <td width="70%" valign="top" class="SubTotal">Sub-total: </td>
  137.                 <td valign="top"  colspan="3" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Hours"/></td>
  138.                 <td valign="top" colspan="1" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Amount"/></td>
  139.             </tr>
  140.             </xsl:if>
  141.             <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">    
  142.               <tr>
  143.                 <td width="70%" valign="top" class="SubTotal">Sub-total: </td>
  144.                 <td valign="top"  colspan="4" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Hours"/></td>
  145.                 <td valign="top" colspan="2" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Amount"/></td>
  146.             </tr>
  147.             </xsl:if>
  148.             </table>
  149.         </xsl:if>
  150.      </xsl:template>
  151.  
  152.     <xsl:template match="Project/Date" mode="customer-date">
  153.         <tr>
  154.             <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
  155.                 <td width="10%" class="DetailRowDataClass"><xsl:value-of select="@Value"/></td>
  156.                 <td width="30%" class="DetailRowDataClass"><xsl:value-of select="Task"/></td>
  157.                 <td width="30%" class="DetailRowDataClass"><xsl:value-of select="Description"/></td>
  158.                 <td width="5%" class="DetailRowDataClass1"><xsl:value-of select="Rate"/></td>
  159.                 <td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Hours"/></td>
  160.                 <td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Amount"/></td>
  161.             </xsl:if>
  162.             <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
  163.                 <td width="10%" class="DetailRowDataClass"><xsl:value-of select="@Value"/></td>
  164.                 <td width="100%" class="DetailRowDataClass"><xsl:value-of select="Task"/></td>
  165.                 <td width="10%" class="DetailRowDataClass1"><xsl:value-of select="Rate"/></td>
  166.                 <td width="20%" class="DetailRowDataClass1"><xsl:value-of select="Hours"/></td>
  167.                 <td width="20%" class="DetailRowDataClass1"><xsl:value-of select="Amount"/></td>
  168.             </xsl:if>
  169.         </tr>
  170.     </xsl:template>
  171.     
  172.     <xsl:template match="/Report/Customer/Tax">
  173.     <table width="70%" align="center">
  174.         <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
  175.             <tr>
  176.                 <td width="60%" class="Tax" aling="right">Tax (<xsl:value-of select="Percent"/>%)</td>
  177.                 <td class="TaxText" align="right"><xsl:value-of select="Value"/></td>
  178.             </tr>
  179.         </xsl:if>
  180.         <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
  181.         <tr>
  182.             <td width="60%" class="Tax" align="right">Tax (<xsl:value-of select="Percent"/>%)</td>
  183.             <td class="TaxText" align="right"><xsl:value-of select="Value"/></td>
  184.         </tr>
  185.         </xsl:if>        
  186.     </table>
  187.     </xsl:template>
  188.     
  189.     <xsl:template match="/Report/Customer/Total">
  190.     <table width="70%" align="center">
  191.     <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='no'">
  192.         <tr>
  193.             <td width="60%" class="Total">Total:</td>
  194.             <td class="Total"><xsl:value-of select="text()"/></td>
  195.         </tr>
  196.     </xsl:if>
  197.     
  198.     <xsl:if test="string(/Report/HeaderInfo/DetailedDescription)='yes'">
  199.         <tr>
  200.             <td width="60%" class="Total">Total:</td>
  201.             <td class="Total"><xsl:value-of select="text()"/></td>
  202.         </tr>
  203.     </xsl:if>            
  204.     
  205.     </table>
  206.     </xsl:template>
  207.     
  208.      <xsl:template match="Companies/Company">
  209.         <xsl:value-of select="text()"/>
  210.         <xsl:if test="following-sibling::*/text()">, </xsl:if>
  211.     </xsl:template>
  212.  
  213.     <xsl:template match="Projects/Project">
  214.         <xsl:value-of select="text()"/>
  215.         <xsl:if test="following-sibling::*/text()">, </xsl:if>
  216.     </xsl:template>
  217.  
  218.     <xsl:template match="Tasks/Task">
  219.         <xsl:value-of select="text()"/>
  220.         <xsl:if test="following-sibling::*/text()">, </xsl:if>
  221.     </xsl:template>
  222.     
  223. </xsl:stylesheet>